/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.spreedairy.portal.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import com.spreedairy.portal.model.CustomField;

import java.io.Serializable;

/**
 * The cache model class for representing CustomField in entity cache.
 *
 * @author SpreeDairy
 * @see CustomField
 * @generated
 */
public class CustomFieldCacheModel implements CacheModel<CustomField>,
	Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(15);

		sb.append("{recId=");
		sb.append(recId);
		sb.append(", categoryId=");
		sb.append(categoryId);
		sb.append(", keyValue=");
		sb.append(keyValue);
		sb.append(", keyType=");
		sb.append(keyType);
		sb.append(", optional=");
		sb.append(optional);
		sb.append(", optionsValue=");
		sb.append(optionsValue);
		sb.append(", fieldOrder=");
		sb.append(fieldOrder);
		sb.append("}");

		return sb.toString();
	}

	public CustomField toEntityModel() {
		CustomFieldImpl customFieldImpl = new CustomFieldImpl();

		customFieldImpl.setRecId(recId);
		customFieldImpl.setCategoryId(categoryId);

		if (keyValue == null) {
			customFieldImpl.setKeyValue(StringPool.BLANK);
		}
		else {
			customFieldImpl.setKeyValue(keyValue);
		}

		if (keyType == null) {
			customFieldImpl.setKeyType(StringPool.BLANK);
		}
		else {
			customFieldImpl.setKeyType(keyType);
		}

		customFieldImpl.setOptional(optional);

		if (optionsValue == null) {
			customFieldImpl.setOptionsValue(StringPool.BLANK);
		}
		else {
			customFieldImpl.setOptionsValue(optionsValue);
		}

		customFieldImpl.setFieldOrder(fieldOrder);

		customFieldImpl.resetOriginalValues();

		return customFieldImpl;
	}

	public long recId;
	public long categoryId;
	public String keyValue;
	public String keyType;
	public boolean optional;
	public String optionsValue;
	public int fieldOrder;
}